package edu.unlv.cs.ladders.web;

import edu.unlv.cs.ladders.entities.Event;
import java.lang.String;
import java.util.Calendar;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

privileged aspect EventController_Roo_Controller {
    
    @RequestMapping(value = "find/ByDateOfEventBetween/form", method = RequestMethod.GET)
    public String EventController.findEventsByDateOfEventBetweenForm(ModelMap modelMap) {
        modelMap.addAttribute("event_minDateOfEvent_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        modelMap.addAttribute("event_maxDateOfEvent_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        return "event/findEventsByDateOfEventBetween";
    }
    
    @RequestMapping(value = "find/ByDateOfEventBetween", method = RequestMethod.GET)
    public String EventController.findEventsByDateOfEventBetween(@RequestParam("minDateOfEvent") @DateTimeFormat(style = "S-") Calendar minDateOfEvent, @RequestParam("maxDateOfEvent") @DateTimeFormat(style = "S-") Calendar maxDateOfEvent, ModelMap modelMap) {
        if (minDateOfEvent == null) throw new IllegalArgumentException("A MinDateOfEvent is required.");
        if (maxDateOfEvent == null) throw new IllegalArgumentException("A MaxDateOfEvent is required.");
        modelMap.addAttribute("events", Event.findEventsByDateOfEventBetween(minDateOfEvent, maxDateOfEvent).getResultList());
        modelMap.addAttribute("event_dateOfEvent_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        modelMap.addAttribute("event_dateOfEvent_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));
        return "event/list";
    }
    
}
